<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>管理控制台</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/styles.css">
</head>
<body>
    <div class="dashboard-container">
        <h2>系统概况</h2>
        
        <!-- 统计卡片 -->
        <div class="status-cards">
            <div class="status-card">
                <h3>待处理申请</h3>
                <p class="count">${autoListI}</p>
            </div>
            <div class="status-card">
                <h3>使用中车辆</h3>
                <p class="count">${VehInt[0]}</p>
            </div>
            <div class="status-card">
                <h3>维修中车辆</h3>
                <p class="count">${VehInt[1]}</p>
            </div>
            <div class="status-card">
                <h3>可用车辆</h3>
                <p class="count">${VehInt[2]}</p>
            </div>
        </div>

        <!-- 待处理事项 -->
        <div class="section-container">
            <div class="section-header">
                <h3>待处理事项</h3>
                <a href="<%=request.getContextPath()%>/pend/PendingServlet?zt=申请&&lb=1" class="btn btn-small btn-secondary">查看全部</a>
            </div>
            <div class="table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>申请时间</th>
                            <th>申请人</th>
                            <th>类型</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>

                    <tbody>
                    <c:forEach items="${autoList}" var="auto"  begin="0" end="4">
                        <tr>
                            <td>${auto.stime}</td>
                            <td>${auto.usernameid}</td>
                            <td>${auto.zhuang}</td>
                            <td><span class="status-tag status-pending">待审批</span></td>
                            <td>
                                <button class="btn btn-small" onclick="location.href='<%=request.getContextPath()%>/admin/pending-events.jsp'">处理</button>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>

        <!-- 车辆使用情况 -->
        <div class="section-container">
            <div class="section-header">
                <h3>车辆使用情况</h3>
                <a href="vehicle-management.jsp" class="btn btn-small btn-secondary">查看详情</a>
            </div>
            <div class="table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>车牌号</th>
                            <th>当前状态</th>
                            <th>使用人</th>
                            <th>预计归还时间</th>
                        </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${VehList}" var="Veh" varStatus="ve"  begin="0" end="4">
                        <tr>
                            <td>${Veh.licensePlate}</td>
                            <td><span class="status-tag status-using">${Veh.status}</span></td>
                            <td>${Veh.currentDriver}</td>
                            <td>${Veh.purchaseDate}</td>
                        </tr>
                    </c:forEach>

                    </tbody>
                </table>
            </div>
        </div>
    </div>
</body>
</html> 